package com.gtw.modules.sys.service.impl;

import com.gtw.dto.TbOrderDto;
import com.gtw.modules.dao.TbOrderDao;
import com.gtw.modules.entity.TbOrder;
import com.gtw.modules.sys.service.SysTbOrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;
import java.util.Map;

/** 订单接口实现类
 *
 * @author wuye
 * @date 2018/1/29
 */
@Service
public class SysTbOrderServiceImpl implements SysTbOrderService{

    @Autowired
    private TbOrderDao orderDao;

    @Override
    public TbOrder queryObject(Integer id){
        return orderDao.queryObject(id);
    }

    @Override
    public List<TbOrder> queryList(Map<String, Object> map){
        return orderDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map){
        return orderDao.queryTotal(map);
    }

    @Override
    public void save(TbOrder order){
        orderDao.save(order);
    }

    @Override
    public void update(TbOrder order){
        orderDao.updateByPrimaryKey(order);
    }

    @Override
    public void delete(Integer id){
        orderDao.delete(id);
    }

    @Override
    public void deleteBatch(Integer[] ids){
        orderDao.deleteBatch(ids);
    }

    /**
     * 根据订单号查询
     * @param billno
     * @return
     */
    @Override
    public TbOrder queryBybillno(String billno) {
        return orderDao.queryBybillno(billno);
    }

    /**
     * 根据用户UID查询订单
     * @param uid
     * @return
     */
    @Override
    public List<TbOrder> queryByUid(String uid) {
        return orderDao.queryByUid(uid);
    }

    /**
     * 查询订单列表,关联地址信息
     *
     * @param orderstatus 订单状态
     * @param starttime   开始时间
     * @return
     */
    @Override
    public List<TbOrderDto> queryListLinkAddress(String orderstatus, Date starttime ) {
        return orderDao.queryListLinkAddress(orderstatus,starttime);
    }
}
